CSharpTest.Net
DecodeBytes(Byte[]) Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Crypto Namespace > AsciiEncoder Class > DecodeBytes Method : DecodeBytes(Byte[]) Method

inData

Glossary Item Box

Decodes the ascii text from the bytes provided into the original byte array

Syntax

Visual Basic (Declaration) 
Public Overloads Shared Function DecodeBytes( _
   ByVal inData() As Byte _
) As Byte()
C# 
public static byte[] DecodeBytes( 
   byte[] inData
)

Parameters

inData

Example

Library/Library.Test/TestSafe64Encoding.cs

C#Copy Code
//char count must by multiple of 4 for the compare to work
string encoded = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_";
byte[] data = Safe64Encoding.DecodeBytes(encoded);
Assert.AreEqual(encoded, Safe64Encoding.EncodeBytes(data));
data = AsciiEncoder.DecodeBytes(encoded);
Assert.AreEqual(encoded, AsciiEncoder.EncodeBytes(data));
data = AsciiEncoder.DecodeBytes(Encoding.ASCII.GetBytes(encoded));
Assert.AreEqual(encoded, AsciiEncoder.EncodeBytes(data));
VB.NETCopy Code
'char count must by multiple of 4 for the compare to work
Dim encoded As String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_"
Dim data As Byte() = Safe64Encoding.DecodeBytes(encoded)
Assert.AreEqual(encoded, Safe64Encoding.EncodeBytes(data))
data = AsciiEncoder.DecodeBytes(encoded)
Assert.AreEqual(encoded, AsciiEncoder.EncodeBytes(data))
data = AsciiEncoder.DecodeBytes(Encoding.ASCII.GetBytes(encoded))
Assert.AreEqual(encoded, AsciiEncoder.EncodeBytes(data))

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys